<?php

namespace app\model;

use app\BaseModel;
use think\model\relation\BelongsTo;

/**
 * 教职工-测评因子得分（因子预警连续测评）
 */
class WorkersTaskFactorScoreContinuityModel extends BaseModel
{
    protected $name = 'workers_task_factor_score_continuity';

    /**
     * 关联量表因子
     * @return BelongsTo
     */
    public function RatingScaleFactor(): BelongsTo
    {
        return $this->belongsTo(RatingScaleFactorModel::class, 'factor_id')->bind([
            'factor_name' => 'name',
            'formula_method',
            'factor_explain',
            'rating_scale_factor_level'
        ]);
    }

    /**
     * 关联量表因子 - 团体
     * @return BelongsTo
     */
    public function TeamRatingScaleFactor(): BelongsTo
    {
        return $this->belongsTo(RatingScaleFactorModel::class, 'factor_id')->bind([
            'factor_name' => 'name',
            'formula_method',
            'factor_explain'
        ]);
    }

    /**
     * 关联量表因子等级
     * @return BelongsTo
     */
    public function RatingScaleFactorLevel(): BelongsTo
    {
        return $this->belongsTo(RatingScaleFactorLevelModel::class, 'factor_level_id')->bind([
            'factor_level_name' => 'name',
            'overview',
            'explain',
        ]);
    }

    /**
     * 关联量表因子预警等级
     * @return BelongsTo
     */
    public function RatingScaleFactorWarning(): BelongsTo
    {
        return $this->belongsTo(RatingScaleFactorWarningModel::class, 'warning_id')->bind([
            'warning_name' => 'name',
        ]);
    }
}